package edu.tju.insurance;

import java.sql.SQLException;

import java.util.List;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.younker.waf.db.IBatisConfig;


public class IbatisInsuranceDao implements IInsuranceDao{
	protected SqlMapClient sqlMap = IBatisConfig.getSqlMapInstance();

	

	public void deleteInsurance(long id) throws SQLException {
		
		sqlMap.delete("deleteInsurance", id);
	}

	
	public List<Insurance> getInsuranceAnd(Insurance insurance)
			throws SQLException {
		
		return sqlMap.queryForList("getInsuranceAnd", insurance);
	}

	
	public Insurance getInsuranceById(long id) throws SQLException {
		
		return (Insurance) sqlMap.queryForObject("getInsuranceById", id);
	}

	
	public List<Insurance> getInsuranceOr(Insurance insurance)
			throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	
	public Long insertInsurance(Insurance insurance) throws SQLException {
		
		return (Long)sqlMap.insert("insertInsurance", insurance);
	}

	public int updateInsurance(Insurance insurance) throws SQLException {
		
		return sqlMap.update("updateInsurance", insurance);
	}

}
